package manage.action;

import m.appserver.AuthInfoUtil;
import m.appserver.ServerResultStatus;
import m.common.action.*;
import m.common.model.Model;
import m.common.model.UserModel;
import m.common.model.util.FromQueryList;
import m.common.model.util.QueryOrder;
import m.common.model.util.QueryPage;
import m.html.VueCollectResult;
import m.html.VueListResult;
import m.html.collect.CollectColumn;
import m.html.collect.CollectColumnType;
import m.html.element.attr.Align;
import m.html.element.other.DisplayItem;
import m.html.list.*;
import m.html.util.VueListPage;
import m.system.RuntimeData;
import m.system.cache.CacheUtil;
import m.system.exception.MException;
import m.system.util.ClassUtil;
import m.system.util.JSONMessage;
import m.system.util.StringUtil;
import manage.model.AdminAssist;
import manage.model.AdminColumn;
import manage.model.AdminLogin;
import manage.model.OrgGroupView;
import manage.service.AdminColumnService;
import manage.util.excel.ExcelObject;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

public abstract class ManageAction extends ImportExcelAction {
	public UserModel getSessionLogUser(){
		return getSessionAdmin();
	}

	@RequestMeta(params = {"threadKey"})
	public JSONMessage getThreadResult(String threadKey) throws Exception {
		Object result=VueListPage.getThreadResult(threadKey);
		if(null==result) return new JSONMessage(2).push("threadKey", threadKey);
		if(result instanceof ExcelObject){
			getResponse().outExcel((ExcelObject) result);
			return new JSONMessage(0);
		}
		return (JSONMessage) result;
	}
	/**
	 * 导出excel
	 *  method
	 */
	@RequestMeta(params= {"method","columns"})
	public JSONMessage exportExcel(String method,String columns) {
		try {
			this.queryData="list";
			VueListPage result=(VueListPage)ClassUtil.executeMethod(this, method);
			result.setColumnsParam(columns);
			ExcelObject excel=result.toExcel();
			getResponse().outExcel(excel);
			return new JSONMessage(0);
		} catch (Exception e) {
			if(e.getMessage().startsWith("threadKey_")){
				return new JSONMessage(2).push("threadKey", e.getMessage());
			}
			e.printStackTrace();
			JSONMessage json=new JSONMessage(1);
			json.setStatus(ServerResultStatus.ERROR);
			json.push("msg", e.getMessage());
			return json;
		}
	}

	/**
	 * 图表数据
	 */
	@RequestMeta(params= {"method"})
	public JSONMessage getEchartsData(String method) throws Exception {
		boolean simple="Y".equals(getParamsValue("simple"));
		IVueEcharts result=(IVueEcharts)ClassUtil.executeMethod(this, method);
		return result.toEchartsOption(simple);
	}
	/**
	 * 图表页面
	 *  method
	 *
	 */
	@RequestMeta(params= {"method","isOpen"})
	public VueResult toEcharts(String method,Boolean isOpen) throws Exception {
		boolean simple="Y".equals(getParamsValue("simple"));
		IVueEcharts result=(IVueEcharts)ClassUtil.executeMethod(this, method);
		JSONMessage option=result.toEchartsOption(simple);
		return new VuePageResult("page/base/util/echarts.js")
			.addParam("isOpen",isOpen)
			.addParam("height",getParamsValue("height"))
			.addParam("option",option);
	}

	/**
	 * 填充结果
	 *  result
	 *  b true正常执行  false有异常
	 *  msg
	 */
	public void fillJSONResult(JSONMessage result,boolean b,String msg) {
		if(b) {
			result.push("code", 0);
			result.push("msg", msg);
		}else {
			if(StringUtil.isSpace(msg)) {
				result.setStatus(ServerResultStatus.EXCEPTION);
				result.push("code", 7);
				result.push("msg", "数据异常");
			}else{
				result.setStatus(ServerResultStatus.ERROR);
				result.push("code", 1);
				result.push("msg", msg);
			}
		}
	}
	public void fillJSONResult(JSONMessage result,boolean b,Exception e){
		fillJSONResult(result,b,e.getMessage());
		if(RuntimeData.getDebug()) e.printStackTrace();
	}
	/**
	 * 获取登录用户信息 返回null说明没有登录
	 * 
	 */
	public AdminLogin getSessionAdmin() {
		return AuthInfoUtil.getSessionAdmin();
	}
	public String getSessionAdminOid() throws MException {
		return AuthInfoUtil.getSessionAdminOid();
	}

	/**
	 * 设置当前登录部门oid
	 */
	public void setSessionOrgGroupId(String orgOid){
		AuthInfoUtil.setSessionOrgGroupId(orgOid);
	}

	/**
	 * 获取当前登录部门
	 */
	public OrgGroupView getSessionOrgGroup() {
		return AuthInfoUtil.getSessionOrgGroup();
	}
	public String getSessionOrgGroupOid() throws MException {
		return AuthInfoUtil.getSessionOrgGroupOid();
	}

	/**
	 * 设置外协session 并设置管理员和登录部门
	 */
	public void setSessionAssist(AdminAssist assist){
		AuthInfoUtil.setSessionAssist(assist);
	}

	/**
	 * 获取当前登录的外协账号
	 */
	public AdminAssist getSessionAssist(){
		return AuthInfoUtil.getSessionAssist();
	}
	/**
	 * 设置session
	 *  admin 登录人信息
	 */
	public void setSessionAdmin(AdminLogin admin){
		AuthInfoUtil.setSessionAdmin(admin);
	}
	/**
	 * 清除登录信息
	 */
	public void clearSessionAdmin(){
		AuthInfoUtil.clearSessionAdmin();
	}
	public Map<String,Boolean> getAdminOperPower() throws SQLException, MException {
		return AuthInfoUtil.getAdminOperPower();
	}
	/**
	 * 验证操作权限
	 *  power 在module.xml配置文件中配置  如果传入多个, 有一个满足即可
	 */
	public AdminLogin verifyAdminOperPower(String... power) throws Exception{
		return  AuthInfoUtil.verifyAdminOperPower(power);
	}
	/**
	 * 判断是否有操作权限  如果传入多个, 有一个满足即可
	 */
	public boolean hasAdminOperPower(String... power) throws Exception {
		return AuthInfoUtil.hasAdminOperPower(power);
	}
	/**
	 * 判断当前登录人是否有菜单操作权限，有一个满足即可
	 */
	public void verifyMenu(String... menuOid) throws Exception {
		AuthInfoUtil.verifyMenu(menuOid);
	}

	/**
	 * 验证登录 未登录则报错
	 */
	public AdminLogin verifyAdminLogin() throws Exception{
		return AuthInfoUtil.verifyAdminLogin();
	}

	private String queryData;
	private String columnsParamKey;
	private Boolean isOpen;
	private QueryPage page;
	private QueryOrder order;
	private Map<String,String> params;

	/**
	 * 重写方法，实现VueListResult预设
	 */
	public void presetVueListResult(VueListResult result){

	}
	/**
	 * 列表页面 
	 *  title 标题
	 *  clazz 模型类
	 *  dataUrl 数据url
	 */
	public <T extends Model> VueListResult getVueListResult(String title,Class<T> clazz,String dataUrl){
		return getVueListResult(title,clazz,dataUrl,false);
	}

	/**
	 * 列表页面
	 *  title 标题
	 *  clazz 模型类
	 *  dataUrl 数据url
	 *  showAllData 是否显示全部数据
	 */
	public <T extends Model> VueListResult getVueListResult(String title,Class<T> clazz,String dataUrl,boolean showAllData) {
		VueListResult result=new VueListResult(title,clazz,dataUrl,queryData,params);
		if(showAllData) result.setPage(null);
		else result.setPage(null==page?new QueryPage():page);
		result.setOrder(order);
		setColumnSetting(result);
		presetVueListResult(result);
		return result;
	}
	private void setColumnSetting(VueListPage page) {
		page.setColumnsParamKey(StringUtil.to32MD5(getRequest().getUri()));
		if(null==getParams()) return;
		AdminLogin admin=getSessionAdmin();
		if(null==admin) return;
		String sc=getParamsValue("save_columns");
		if(StringUtil.notSpace(sc)){
			try {
				getService(AdminColumnService.class).save(admin,getRequest().getUri(),getColumnsParamKey(),sc);
			}catch (Exception ignored){ }
		}
		AdminColumn ac=CacheUtil.get(AdminColumn.class,admin.getOid(),getColumnsParamKey());
		if(null!=ac) page.setColumnsParam(StringUtil.noSpace(ac.getViewParams()));
	}
	/**
	 * 重写方法，实现VueCollectResult预设
	 */
	public void presetVueCollectResult(VueCollectResult result){

	}
	/**
	 * 汇总页面
	 *  title 标题
	 *  from 查询
	 *  dataUrl 数据url
	 */
	public VueCollectResult getVueCollectResult(String title,FromQueryList from,String dataUrl) {
		return getVueCollectResult(title,from,dataUrl,false);
	}
	/**
	 * 汇总页面
	 *  title 标题
	 *  from 查询
	 *  dataUrl 数据url
	 *  showAllData 是否显示全部数据
	 */
	public VueCollectResult getVueCollectResult(String title,FromQueryList from,String dataUrl,boolean showAllData) {
		VueCollectResult result=new VueCollectResult(title,from,dataUrl,queryData,params);
		if(showAllData) result.setPage(null);
		else result.setPage(null==page?new QueryPage():page);
		result.setOrder(order);
		setColumnSetting(result);
		presetVueCollectResult(result);
		return result;
	}
	/**
	 * 获取params里的的值
	 *  name
	 *  不存在返回空字符串
	 */
	public String getParamsValue(String name) {
		if(null!=this.getParams()&&null!=this.getParams().get(name)) {
			return StringUtil.noSpace(this.getParams().get(name));
		}
		return "";
	}
	/**
	 * 获取params里的的值
	 *  name
	 *  不存在返回 defaultValue
	 */
	public String getParamsValue(String name,String defaultValue){
		String v=getParamsValue(name);
		if(StringUtil.isSpace(v)) return defaultValue;
		return v;
	}
	/**
	 * 序号列
	 * 
	 */
	public ListColumn toIndexColumn(String title) {
		return new ListColumn(ListColumnType.INDEX,title,"tmp_index",45).setAlign(Align.RIGHT).setFixed(Align.LEFT);
	}
	public ListColumn toIndexColumn() {
		return toIndexColumn("序号");
	}
	public CollectColumn collectIndexColumn(String title) throws MException {
		return new CollectColumn(CollectColumnType.INDEX,title,"tmp_index",45).setAlign(Align.RIGHT).setFixed(Align.LEFT);
	}
	public CollectColumn collectIndexColumn() throws MException {
		return collectIndexColumn("序号");
	}
	/**
	 * 状态列   oper是否可操作
	 * 
	 */
	public ListColumn toStatusColumn(boolean oper) {
		return toStatusColumn(oper,"status","");
	}
	public ListColumn toStatusColumn(boolean oper,boolean filter) {
		if(filter) return toStatusColumn(oper).setFilter(SearchType.HIDDEN_EQ);
		else return toStatusColumn(oper);
	}
	public ListColumn toStatusColumn(boolean oper,String field,String action) {
		return new ListColumn(ListColumnType.STATUS,"状态",field).setOper(oper).setAction(action).setAlign(Align.CENTER)
				.setDisItems(DisplayItem.toList("status"));
	}
	/**
	 * 图片列
	 */
	public ListColumn toImageColumn(String title,String field,String viewField) {
		return new ListColumn(ListColumnType.IMAGE,title,field).setAction(viewField).setWidth(80).setAlign(Align.CENTER);
	}
	public ListColumn toImageColumn(String title,String field,String viewField,int width) {
		return toImageColumn(title, field,viewField).setWidth(width);
	}
	/**
	 * 间隔列
	 */
	public ListColumn toSpaceColumn(String title,IListElement... eles) {
		return toSpaceColumn(title,100,eles);
	}
	private int tmp_int=0;
	public ListColumn toSpaceColumn(String title,int width,IListElement... eles) {
		ListElement spc=new ListElement("a-space");
		spc.addElement(eles);
		tmp_int++;
		ListColumn col=toTextColumn(title, "tmp_int_"+tmp_int,width).setAlign(Align.CENTER);
		col.addElement(spc);
		return col;
	}
	public CollectColumn collectSpaceColumn(String title,IListElement... eles) throws MException {
		return collectSpaceColumn(title,100,eles);
	}
	public CollectColumn collectSpaceColumn(String title,int width,IListElement... eles) throws MException {
		ListElement spc=new ListElement("a-space");
		spc.addElement(eles);
		tmp_int++;
		CollectColumn col=collectTextColumn(title, "tmp_int_"+tmp_int,width).setAlign(Align.CENTER);
		col.addElement(spc);
		return col;
	}
	/**
	 * 元素列
	 *  title
	 *  eles
	 * 
	 */
	public ListColumn toElementColumn(String title,IListElement... eles) {
		return toElementColumn(title, 100, eles);
	}
	public ListColumn toElementColumn(String title,int width,IListElement... eles){
		tmp_int++;
		return toElementColumn(title,"tmp_int_"+tmp_int,width,eles);
	}
	public ListColumn toElementColumn(String title,String field,int width,IListElement... eles) {
		ListColumn col=toTextColumn(title, field, width);
		for(IListElement ele : eles) {
			col.addElement(ele);
		}
		return col;
	}
	public ListColumn toHtmlColumn(String title,String html) {
		return toHtmlColumn(title,100,html);
	}
	public ListColumn toHtmlColumn(String title,int width,String html){
		tmp_int++;
		return toHtmlColumn(title,"tmp_int_"+tmp_int,width,html);
	}
	public ListColumn toHtmlColumn(String title,String field,int width,String html) {
		ListColumn col=toTextColumn(title, field, width);
		col.addElement(new ListElement("span").addText(html));
		return col;
	}
	public CollectColumn collectElementColumn(String title,IListElement... eles) throws MException {
		return collectElementColumn(title, 100, eles);
	}
	public CollectColumn collectElementColumn(String title,int width,IListElement... eles) throws MException {
		tmp_int++;
		return collectElementColumn(title, "tmp_int_"+tmp_int,width, eles);
	}
	public CollectColumn collectElementColumn(String title,String field,int width,IListElement... eles) throws MException {
		CollectColumn col=collectTextColumn(title, field, width);
		for(IListElement ele : eles) {
			col.addElement(ele);
		}
		return col;
	}
	public CollectColumn collectHtmlColumn(String title,String html) throws MException {
		return collectHtmlColumn(title,100,html);
	}
	public CollectColumn collectHtmlColumn(String title,int width,String html) throws MException {
		tmp_int++;
		return collectHtmlColumn(title,"tmp_int_"+tmp_int,width,html);
	}
	public CollectColumn collectHtmlColumn(String title,String field,int width,String html) throws MException {
		CollectColumn col=collectTextColumn(title, field, width);
		col.addElement(new ListElement("span").addText(html));
		return col;
	}
	/**
	 * 链接列
	 */
	public ListColumn toLinkColumn(String title,String field,ListEvent event) {
		return new ListColumn(ListColumnType.LINK,title,field).setLinkEvent(event);
	}
	public ListColumn toLinkColumn(String title,String field,boolean filter,ListEvent event) {
		return toLinkColumn(title,field,event).setFilter(SearchType.HIDDEN_MANY_LIKE).setFilter(filter);
	}
	public ListColumn toLinkColumn(String title,String field,int width,ListEvent event) {
		return toLinkColumn(title,field,event).setWidth(width);
	}
	public ListColumn toLinkColumn(String title,String field,int width,boolean filter,ListEvent event) {
		return toLinkColumn(title,field,event).setWidth(width).setFilter(SearchType.HIDDEN_MANY_LIKE).setFilter(filter);
	}
	public CollectColumn collectLinkColumn(String title,String field,ListEvent event) throws MException {
		return new CollectColumn(CollectColumnType.LINK,title,field).setLinkEvent(event);
	}
	public CollectColumn collectLinkColumn(String title,String field,boolean filter,ListEvent event) throws MException {
		return collectLinkColumn(title,field,event).setFilter(SearchType.HIDDEN_MANY_LIKE).setFilter(filter);
	}
	public CollectColumn collectLinkColumn(String title,String field,int width,ListEvent event) throws MException {
		return collectLinkColumn(title,field,event).setWidth(width);
	}
	public CollectColumn collectLinkColumn(String title,String field,int width,boolean filter,ListEvent event) throws MException {
		return collectLinkColumn(title,field,event).setWidth(width).setFilter(SearchType.HIDDEN_MANY_LIKE).setFilter(filter);
	}
	/**
	 * 文本列
	 */
	public ListColumn toTextColumn(String title,String field) {
		return new ListColumn(title,field);
	}
	public ListColumn toTextColumn(String title,String field ,boolean filter) {
		return new ListColumn(title,field).setFilter(SearchType.HIDDEN_MANY_LIKE).setFilter(filter);
	}
	public ListColumn toTextColumn(String title,String field,int width) {
		return new ListColumn(title,field).setWidth(width);
	}
	public ListColumn toTextColumn(String title,String field,int width,boolean filter) {
		return new ListColumn(title,field).setWidth(width).setFilter(SearchType.HIDDEN_MANY_LIKE).setFilter(filter);
	}
	public CollectColumn collectTextColumn(String title,String field) throws MException {
		return new CollectColumn(title,field);
	}
	public CollectColumn collectTextColumn(String title,String field ,boolean filter) throws MException {
		return new CollectColumn(title,field).setFilter(SearchType.HIDDEN_MANY_LIKE).setFilter(filter);
	}
	public CollectColumn collectTextColumn(String title,String field,int width) throws MException {
		return new CollectColumn(title,field).setWidth(width);
	}
	public CollectColumn collectTextColumn(String title,String field,int width,boolean filter) throws MException {
		return new CollectColumn(title,field).setWidth(width).setFilter(SearchType.HIDDEN_MANY_LIKE);
	}
	/**
	 * 日期列
	 */
	public ListColumn toDateColumn(String title,String field) {
		return toTextColumn(title, field).setDateFormat("yyyy-MM-dd").setAlign(Align.CENTER);
	}
	public ListColumn toDateColumn(String title,String field ,boolean filter) {
		return toDateColumn(title,field).setFilter(SearchType.HIDDEN_DATE_RANGE).setFilter(filter);
	}
	public ListColumn toDateColumn(String title,String field,int width) {
		return toTextColumn(title, field, width).setDateFormat("yyyy-MM-dd").setAlign(Align.CENTER);
	}
	public ListColumn toDateColumn(String title,String field,int width,boolean filter) {
		return toDateColumn(title,field,width).setFilter(SearchType.HIDDEN_DATE_RANGE).setFilter(filter);
	}
	public CollectColumn collectDateColumn(String title,String field) throws MException {
		return collectTextColumn(title, field).setDateFormat("yyyy-MM-dd").setAlign(Align.CENTER);
	}
	public CollectColumn collectDateColumn(String title,String field ,boolean filter) throws MException {
		return collectDateColumn(title,field).setFilter(SearchType.HIDDEN_DATE_RANGE).setFilter(filter);
	}
	public CollectColumn collectDateColumn(String title,String field,int width) throws MException {
		return collectTextColumn(title, field, width).setDateFormat("yyyy-MM-dd").setAlign(Align.CENTER);
	}
	public CollectColumn collectDateColumn(String title,String field,int width,boolean filter) throws MException {
		return collectDateColumn(title,field,width).setFilter(SearchType.HIDDEN_DATE_RANGE).setFilter(filter);
	}
	/**
	 * 时间列
	 */
	public ListColumn toDateTimeColumn(String title,String field) {
		return toTextColumn(title, field).setDateFormat("yyyy-MM-dd HH:mm").setAlign(Align.CENTER);
	}
	public ListColumn toDateTimeColumn(String title,String field ,boolean filter) {
		return toDateTimeColumn(title,field).setFilter(SearchType.HIDDEN_DATETIME_RANGE).setFilter(filter);
	}
	public ListColumn toDateTimeColumn(String title,String field,int width) {
		return toTextColumn(title, field, width).setDateFormat("yyyy-MM-dd HH:mm").setAlign(Align.CENTER);
	}
	public ListColumn toDateTimeColumn(String title,String field,int width,boolean filter) {
		return toDateTimeColumn(title,field,width).setFilter(SearchType.HIDDEN_DATETIME_RANGE).setFilter(filter);
	}
	public CollectColumn collectDateTimeColumn(String title,String field) throws MException {
		return collectTextColumn(title, field).setDateFormat("yyyy-MM-dd HH:mm").setAlign(Align.CENTER);
	}
	public CollectColumn collectDateTimeColumn(String title,String field ,boolean filter) throws MException {
		return collectDateTimeColumn(title,field).setFilter(SearchType.HIDDEN_DATETIME_RANGE).setFilter(filter);
	}
	public CollectColumn collectDateTimeColumn(String title,String field,int width) throws MException {
		return collectTextColumn(title, field, width).setDateFormat("yyyy-MM-dd HH:mm").setAlign(Align.CENTER);
	}
	public CollectColumn collectDateTimeColumn(String title,String field,int width,boolean filter) throws MException {
		return collectDateTimeColumn(title,field,width).setFilter(SearchType.HIDDEN_DATETIME_RANGE).setFilter(filter);
	}
	/**
	 * 数字列
	 */
	public ListColumn toNumberColumn(String title,String field) {
		return toTextColumn(title, field).setNumberFormat("#,##0.00").setAlign(Align.RIGHT).setCount(ListCount.SUM);
	}
	public ListColumn toNumberColumn(String title,String field ,boolean filter) {
		return toNumberColumn(title,field).setFilter(SearchType.HIDDEN_NUMBER_RANGE).setCount(ListCount.SUM).setFilter(filter);
	}
	public ListColumn toNumberColumn(String title,String field,int width) {
		return toTextColumn(title, field, width).setNumberFormat("#,##0.00").setAlign(Align.RIGHT).setCount(ListCount.SUM);
	}
	public ListColumn toNumberColumn(String title,String field,int width,boolean filter) {
		return toNumberColumn(title,field,width).setFilter(SearchType.HIDDEN_NUMBER_RANGE).setCount(ListCount.SUM).setFilter(filter);
	}
	public CollectColumn collectNumberColumn(String title,String field) throws MException {
		return collectTextColumn(title, field).setNumberFormat("#,##0.00").setAlign(Align.RIGHT).setCount(ListCount.SUM);
	}
	public CollectColumn collectNumberColumn(String title,String field ,boolean filter) throws MException {
		return collectNumberColumn(title,field).setFilter(SearchType.HIDDEN_NUMBER_RANGE).setCount(ListCount.SUM).setFilter(filter);
	}
	public CollectColumn collectNumberColumn(String title,String field,int width) throws MException {
		return collectTextColumn(title, field, width).setNumberFormat("#,##0.00").setAlign(Align.RIGHT).setCount(ListCount.SUM);
	}
	public CollectColumn collectNumberColumn(String title,String field,int width,boolean filter) throws MException {
		return collectNumberColumn(title,field,width).setFilter(SearchType.HIDDEN_NUMBER_RANGE).setCount(ListCount.SUM).setFilter(filter);
	}
	/**
	 * 整型列
	 */
	public ListColumn toIntegerColumn(String title,String field) {
		return toTextColumn(title, field).setNumberFormat("#,##0").setAlign(Align.RIGHT).setCount(ListCount.SUM);
	}
	public ListColumn toIntegerColumn(String title,String field ,boolean filter) {
		return toIntegerColumn(title,field).setFilter(SearchType.HIDDEN_NUMBER_RANGE).setCount(ListCount.SUM).setFilter(filter);
	}
	public ListColumn toIntegerColumn(String title,String field,int width) {
		return toTextColumn(title, field, width).setNumberFormat("#,##0").setAlign(Align.RIGHT).setCount(ListCount.SUM);
	}
	public ListColumn toIntegerColumn(String title,String field,int width,boolean filter) {
		return toIntegerColumn(title,field,width).setFilter(SearchType.HIDDEN_NUMBER_RANGE).setCount(ListCount.SUM).setFilter(filter);
	}
	public CollectColumn collectIntegerColumn(String title,String field) throws MException {
		return collectTextColumn(title, field).setNumberFormat("#,##0").setAlign(Align.RIGHT).setCount(ListCount.SUM);
	}
	public CollectColumn collectIntegerColumn(String title,String field ,boolean filter) throws MException {
		return collectIntegerColumn(title,field).setFilter(SearchType.HIDDEN_NUMBER_RANGE).setCount(ListCount.SUM).setFilter(filter);
	}
	public CollectColumn collectIntegerColumn(String title,String field,int width) throws MException {
		return collectTextColumn(title, field, width).setNumberFormat("#,##0").setAlign(Align.RIGHT).setCount(ListCount.SUM);
	}
	public CollectColumn collectIntegerColumn(String title,String field,int width,boolean filter) throws MException {
		return collectIntegerColumn(title,field,width).setFilter(SearchType.HIDDEN_NUMBER_RANGE).setCount(ListCount.SUM).setFilter(filter);
	}
	/////////////////////
	public String getQueryData() {
		return queryData;
	}
	public void setQueryData(String queryData) {
		this.queryData = queryData;
	}
	public QueryPage getPage() {
		return page;
	}
	public void setPage(QueryPage page) {
		this.page = page;
	}
	public QueryOrder getOrder() {
		return order;
	}
	public void setOrder(QueryOrder order) {
		this.order = order;
	}
	public Map<String, String> getParams() {
		if(null==params) params=new HashMap<>();
		return params;
	}
	public void setParams(Map<String, String> params) {
		this.params = params;
	}

	public Boolean getOpen() {
		return isOpen;
	}

	public void setOpen(Boolean open) {
		isOpen = open;
	}

	public String getColumnsParamKey() {
		return columnsParamKey;
	}

	public void setColumnsParamKey(String columnsParamKey) {
		this.columnsParamKey = columnsParamKey;
	}
}
